﻿using System;
using Sarnata.Net.BareFtp.Protocol;
using Sarnata.Net.BareFtp.Protocol.Ftp;
using Sarnata.Net;

namespace SarnataTestConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var ftpConnection = new FTPConnection(new ConnectionProperties
                         {
                             Hostname = "XXX.XXX.XXX.XXX",
                             Port = 21,
                             FTPS = true,
                             User = "username",
                             Password = "password",
                             Passive = true
                         });
            ftpConnection.Open();
            ftpConnection.SetCurrentDirectory(ftpConnection.GetCurrentDirectory() + "/IN");

            var bp = new BarePath();
            bp.SetBaseRemote(ftpConnection.GetCurrentDirectory());
            bp.SetBaseLocal(@"c:\\");
            bp.SetFileName("", "Test.txt");

            var xf = new XferFile(0, bp, 0, TransferDirection.Upload, false, "65.217.78.38");
            ftpConnection.SendFile(xf);

            bp.SetBaseLocal(@"c:\\");

            xf = new XferFile(0, bp, 0, TransferDirection.Download, false, "65.217.78.38");
            ftpConnection.GetFile(xf);

            ftpConnection.Close();

            //var sfh = new SimpleFtpHelper()
            //              {
            //                  FtpHost = "xxx.xxx.xxx.xx",
            //                  FtpUser = "username",
            //                  FtpPassword = "password"
            //              };

            //sfh.UploadSecurely("c:\\Text.txt", "IN");

            //sfh.DownloadSecurely("./IN/Text.txt", "c:\\");



            
            Console.ReadKey(true);
        }
    }
}
